namespace Collaboris.Saf.Actions.Wss.Tests.Generated
{
    using System.IO;

    using Engine.Report;

    using Microsoft.SharePoint;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Saf.Tests;

    using SharePoint.Wss.Lists;

    using Wss.ContentMigration;

    using SharePoint.Wss.ContentMigration;

    using TestHelper = Collaboris.Saf.Actions.Wss.Tests.TestHelper;

    [TestClass]
    public class ImportListTest
    {

        /// <summary>
        /// This test was originally generated but has now been tested and verfiied by MJ
        /// </summary>
        [TestMethod]
        public void ImportList_Test()
        {
            WSSTestAssistant<ImportList, ListImportSettings> importlist =
                    new WSSTestAssistant<ImportList, ListImportSettings>(TestEnvironment.PublishingSite,
                        "ImportListTestWeb", "BLANKINTERNET#0");

            using (importlist)
            {
                string filename = Path.Combine(
                    importlist.FirstEntity.ImportSettings.FileLocation,
                    importlist.FirstEntity.ImportSettings.BaseFileName);

                // create a person list but dont chuck any data inside it
                TestHelper.CreateTasksList(importlist.TestWeb, true, false);


                // this doesn't get tested in isolation...
                // the ExportList_Test created it and actually calls this test directly.
                if (System.IO.File.Exists(filename))
                {
                    MacroReport doReport = importlist.DoMacro();

                    Assert.IsNotNull(SPListHelper.GetList(importlist.TestWeb, importlist.FirstEntity.ListName));
                }

                SPList list = SPListHelper.GetList(importlist.TestWeb, "TestTasks", true);
                SPListItem item = list.Items[0];
                Assert.IsTrue((string)item["Description"] == "some desc");
                Assert.IsTrue((string)item["Title"] == "Created for testing");
                

            }
        }

    }
}
